<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Docking Code</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" type="image/png" href="/static/i/favicon.png">
    <link rel="apple-touch-icon-precomposed" href="/static/i/app-icon72x72@2x.png">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="/static/css/amazeui.min.css"/>
    <link rel="stylesheet" href="/static/css/app.css">
    <link rel="stylesheet" href="/static/css/amazeui.datatables.min.css"/>
    <script src="/static/js/jquery.min.js"></script>
</head>
<body class="theme-white">
<div class="am-g tpl-g">
    <div class="portlet-body form">
        <form id="createcontroller" class="am-form" action="/node/createcontroller" method="post">
            <fieldset>
                <legend>创建控制器</legend>

                <div class="am-form-group">
                    <label for="doc-ipt-email-1">名称</label>
                    <input type="text" class="" id="doc-ipt-email-1" name="controllername" placeholder="">
                </div>

                <div class="am-form-group">
                    <label class="am-checkbox-inline">
                        <input type="checkbox" value="1" name="check"> 基本
                    </label>
                    <label class="am-checkbox-inline">
                        <input type="checkbox" value="2" name="check"> Json接口
                    </label>
                    <label class="am-checkbox-inline">
                        <input type="checkbox" value="3" name="check"> Modal 接口
                    </label>
                </div>

                <p>
                    <button type="submit" class="am-btn am-btn-default">提交</button>
                </p>
            </fieldset>
        </form>
    </div>
</div>
</body>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script>
    $(function () {
        $("form").submit(function () {
            var $form = $(this);
            $.post($form.attr("action"), $form.serialize(), function (data) {

                if (data === true) {
                    layer.msg("添加成功", {
                        shift: 1
                    });
                    setTimeout(function () {
                        window.parent.location.reload();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    }, 1000);

                    return false;
                } else {
                    layer.msg(data.message, {
                        shift: 5
                    });
                    return false;
                }
            }, "json");
            return false;
        });
    });
</script>
</html>